(function(){
    var list = getNode("table");
    var line = list.children[0];
    clearAll(list);
    for(var i=0;i<publicParam.salaryList.length;i++){
        var s = publicParam.salaryList[i];
        var newLine = line.cloneNode(true);
        list.appendChild(newLine);
        //点击发薪理由查看详细信息
        var reason = getSubNode(newLine,"reason");
        reason.innerText = shortName(s.reason);
        reason.tag = s;
        reason.onclick = function(){
            goto("salary/detail",this.tag);
        };
        var member = getSubNode(newLine,"member");
        var m = getMemberByAddress(s.member);
        member.innerText = m.name;
        member.tag = m.address;
        //让会员名可以点击，进入详细页面进行操作
        member.onclick=function(){
            goto("member/info",this.tag);
        }
        //显示其余信息
        var start = getSubNode(newLine,"start");
        start.innerText = dateFormat(s.start);
        if (s.end.toNumber()!=0){
            var end = getSubNode(newLine,"end");
            end.innerText = dateFormat(s.end);
        }
        var period = getSubNode(newLine,"period");
        if (s.period.toNumber()==0) period.innerText="单次";
        else if (s.period.toNumber()==86400) period.innerText="每日";
        else if (s.period.toNumber()==2635200) period.innerText="每月";
        else if (s.period.toNumber()==31557600) period.innerText="每年";
        var amount = getSubNode(newLine,"amount");
        amount.innerText=format(s.amount);
        var state = getSubNode(newLine,"state");
        //根据状态值显示
        if (s.approved){
            if (s.active) state.innerText="发放中";
            else state.innerText="已停止";
        }else{
            state.innerText="待批准";
        }
    }
})();